package J03return;

import java.util.Random;

public class J02over {
    public static void main(String[] args) {
//        return;
        f1();

        int x1 = f2();
        System.out.println("x1 = " + x1);
        System.out.println(f2());

        f2();//有返回值，可以不接受
    }

    public static int f2() {

        

//        return "bc";
        return 7;
    }
    //function
    public static void f1(){
        System.out.println(1);
        System.out.println(2);
        //函数结束，无论后面是否有返回值，函数结束，类似break
        Random r = new Random();
        if(r.nextInt(10)>5){
            System.out.println("不输出3");
            return;
        }
        System.out.println("输出3");
    }
}
